﻿using System;
using System.Windows.Input;

namespace WPFUnitTesting
{
    public class SaveCustomerCommand :ICommand
    {
        public void Execute(object parameter)
        {
            var customerViewModel = parameter as CustomerViewModel;
            if (!String.IsNullOrEmpty(customerViewModel.CustomerName))
                customerViewModel.Customers.Add(new Customer() { Name = customerViewModel.CustomerName, DateOfBirth = DateTime.Parse(customerViewModel.DateOfBirth) });
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;
    }
}
